// pages/personal/sex.js
var util = require('../../utils/util');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    icurl:'../../images/sex.png',
    icboy:'../../images/sex-boy.png',
    icgirl: '../../images/sex-girl.png',
    btnclass:'btn disabled',/*如果按钮可点击去掉disabled*/
    selectSex:'1'
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    //wx.setStorageSync('nowQuestion', url);
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  },
  selectMale:function(){
    this.setData({ icgirl: '../../images/sex-girl.png',icboy: '../../images/sex-boy-h.png', selectSex:'1'});
  },
  selectFeMale:function(){
    this.setData({ icboy: '../../images/sex-boy.png',icgirl: '../../images/sex-girl-h.png', selectSex: '2' });
  },
  toNextPage:function(){
    var sex = this.data.selectSex;
    if (!sex){
      util.wxModalAlert({ content: '选择性别!'});
      return;
    }
    wx.setStorageSync('selectSex', sex);
    var nowQuestion = wx.getStorageSync('nowQuestion');

    nowQuestion.value = sex;
    var questionInfo = wx.getStorageSync('questionInfo')||[];
    questionInfo.push(nowQuestion);
    wx.setStorageSync('questionInfo', questionInfo);
    util.nextQuestion(nowQuestion.location+1);
  }
})